<template>
  <div class="flex flex-col h-full">
    <div class="flex flex-row items-center justify-between px-6 h-[70px] w-full">
      <div></div>
      <div class="font-bold">岗位选择</div>
      <van-icon name="close" />
    </div>

    <div class="flex-auto overflow-y-auto bg-white">
      <van-cell v-for="item of list" :title="item" @click="onSelect(item)">
        <template #right-icon v-if="item === _selectedItem">
          <van-icon name="success" class="search-icon"  color="#436BFF"/>
        </template>
      </van-cell>
    </div>

    <div class="flex flex-row items-center h-[40px]">
      <van-icon name="plus" ></van-icon>
      新建岗位
    </div>
  </div>
</template>

<script setup>
import { defineProps, defineEmits, ref } from "vue";

const emits = defineEmits(['onSelect'])
const props = defineProps({
  list: {
    typeof: Array,
    default: [1, 1, 1],
  },
  selectedItem: {
    typeof: String,
    default: "",
  }
});

const _selectedItem = ref(props.selectedItem);

function onSelect(item) {
    _selectedItem.value = item;
    emits('onSelect', item)
}

</script>

<style lang="less" scoped></style>
